package airlinesystem;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Represents an actual flight in the Airline System
 * @author Robert Maaskant & Dennis van der Zwet
 *
 */
public class SpecificFlight
{
  /**
   * The departure date of this flight
   */
  private Date date;
  /**
   * The RegularFlight this flight implements
   */
  private RegularFlight regularFlight;
  /**
   * The bookings for this flight
   */
  private Set<Booking> bookings;
  /**
   * Next seat number to assign when a new booking is made
   */
  private int nextSeatNumber;
  /**
   * The employees working on this flight
   */
  private Set<EmployeeRole> employees;
  
  /**
   * Constructor for SpecificFlight
   * @param date the departure date of this flight
   * @param regularFlight the RegularFlight this flight implements
   */
  public SpecificFlight(Date date, RegularFlight regularFlight)
  {
    this.date = date;
    this.regularFlight = regularFlight;
    regularFlight.addSpecificFlight(this);
    bookings = new HashSet<Booking>();
    nextSeatNumber = 0;
  }

  /**
   * Returns the departure date of this flight
   * @return the departure date of this flight
   */
  public Date getDate()
  {
    return date;
  }

  /**
   * Returns the RegularFlight this flight implements
   * @return the RegularFlight this flight implements
   */
  public RegularFlight getRegularFlight()
  {
    return regularFlight;
  }
  
  /**
   * Adds a booking to this flight
   * @param b the booking to add
   */
  public void addBooking(Booking b)
  {
    bookings.add(b);
    nextSeatNumber++;
  }
  
  /**
   * Returns the number of a seat that is still empty
   * @return the number of a seat that is still empty
   */
  public int getNextSeatNumber()
  {
    return nextSeatNumber;
  }
  
  /**
   * Adds an employee that works on this flight
   * @param e the employee to add
   */
  public void addEmployee(EmployeeRole e)
  {
    employees.add(e);
  }
  
}
